package com.htandroid.htandroid.webservice;

import java.util.ArrayList;

import org.xmlpull.v1.XmlSerializer;


import android.util.Xml;

import com.htandroid.htandroid.entity.MrqgdSpListDetail;
import com.htandroid.htandroid.entity.UffjqgdList_detail;
import com.htandroid.htandroid.sys.Basenvo;
import com.htandroid.htandroid.tools.ToolLog;

//生成xml的文本信息
public class BuildQgdDjdetailXMLService {

    public String buildXML(ArrayList<UffjqgdList_detail> qgdlist, String methodName, String namespace, String[] param, String[] val, String param_o) {
        String xmlstring = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>";
        //添加方法名
        xmlstring = xmlstring + "<" + methodName + " xmlns=\"" + namespace + "\"> \r\n";
        //前参
        for (int i = 0; i < param.length; i++) {
            xmlstring = xmlstring + "<" + param[i] + ">" + val[i] + "</" + param[i] + "> \r\n";
        }
        if (qgdlist != null) {
            //对象参数
            xmlstring = xmlstring + "<" + param_o + ">\r\n";
            for (int i = 0; i < qgdlist.size(); i++) {
                UffjqgdList_detail qgds = qgdlist.get(i);
                xmlstring = xmlstring + "<UffjqgdList_detail xmlns=\"http://entity.test.com\">\r\n";//必须指定映射文件所在的路径,否则webservice默认的是当前路径
                xmlstring = xmlstring + "<cvouchid>" + Basenvo.AdjDigest(qgds.getCvouchid()) + "</cvouchid>\r\n";
                xmlstring = xmlstring + "<cinvcode>" + Basenvo.AdjDigest(qgds.getCinvcode()) + "</cinvcode>\r\n";
                xmlstring = xmlstring + "<cinvname>" + Basenvo.AdjDigest(qgds.getCinvname()) + "</cinvname>\r\n";
                xmlstring = xmlstring + "<cinvstd>" + Basenvo.AdjDigest(qgds.getCinvstd()) + "</cinvstd>\r\n";
                xmlstring = xmlstring + "<cinvm_unit>" + Basenvo.AdjDigest(qgds.getCinvm_unit()) + "</cinvm_unit>\r\n";
                xmlstring = xmlstring + "<cinva_unit>" + Basenvo.AdjDigest(qgds.getCinva_unit()) + "</cinva_unit>\r\n";
                xmlstring = xmlstring + "<iinvexchrate>" + Basenvo.AdjDigest(qgds.getIinvexchrate()) + "</iinvexchrate>\r\n";
                xmlstring = xmlstring + "<binvtype>" + Basenvo.AdjDigest(qgds.getBinvtype()) + "</binvtype>\r\n";
                xmlstring = xmlstring + "<cinvaddcode>" + Basenvo.AdjDigest(qgds.getCinvaddcode()) + "</cinvaddcode>\r\n";
                xmlstring = xmlstring + "<ddate_dh>" + Basenvo.AdjDigest(qgds.getDdate_dh()) + "</ddate_dh>\r\n";
                xmlstring = xmlstring + "<inum>" + Basenvo.AdjDigest(qgds.getInum()) + "</inum>\r\n";
                xmlstring = xmlstring + "<isnum>" + Basenvo.AdjDigest(qgds.getIsnum()) + "</isnum>\r\n";
                xmlstring = xmlstring + "<iquantity>" + Basenvo.AdjDigest(qgds.getIquantity()) + "</iquantity>\r\n";
                xmlstring = xmlstring + "<iqgq>" + Basenvo.AdjDigest(qgds.getIqgq()) + "</iqgq>\r\n";
                xmlstring = xmlstring + "<iprice>" + Basenvo.AdjDigest(qgds.getIprice()) + "</iprice>\r\n";
                xmlstring = xmlstring + "<iamount>" + Basenvo.AdjDigest(qgds.getIamount()) + "</iamount>\r\n";
                xmlstring = xmlstring + "<cvencodep1>" + Basenvo.AdjDigest(qgds.getCvencodep1()) + "</cvencodep1>\r\n";
                xmlstring = xmlstring + "<cvennamep1>" + Basenvo.AdjDigest(qgds.getCvennamep1()) + "</cvennamep1>\r\n";
                xmlstring = xmlstring + "<cvencodep2>" + Basenvo.AdjDigest(qgds.getCvencodep2()) + "</cvencodep2>\r\n";
                xmlstring = xmlstring + "<cvennamep2>" + Basenvo.AdjDigest(qgds.getCvennamep2()) + "</cvennamep2>\r\n";
                xmlstring = xmlstring + "<cvencodep3>" + Basenvo.AdjDigest(qgds.getCvencodep3()) + "</cvencodep3>\r\n";
                xmlstring = xmlstring + "<cvennamep3>" + Basenvo.AdjDigest(qgds.getCvennamep3()) + "</cvennamep3>\r\n";
                xmlstring = xmlstring + "<ipricep1>" + Basenvo.AdjDigest(qgds.getIpricep1()) + "</ipricep1>\r\n";
                xmlstring = xmlstring + "<ipricep2>" + Basenvo.AdjDigest(qgds.getIpricep2()) + "</ipricep2>\r\n";
                xmlstring = xmlstring + "<ipricep3>" + Basenvo.AdjDigest(qgds.getIpricep3()) + "</ipricep3>\r\n";
                xmlstring = xmlstring + "<cchecker>" + Basenvo.AdjDigest(qgds.getCchecker()) + "</cchecker>\r\n";
                xmlstring = xmlstring + "<ccheckdate>" + Basenvo.AdjDigest(qgds.getCcheckdate()) + "</ccheckdate>\r\n";
                xmlstring = xmlstring + "<cdisapprovereason>" + Basenvo.AdjDigest(qgds.getCdisapprovereason()) + "</cdisapprovereason>\r\n";
                xmlstring = xmlstring + "<cvencode>" + Basenvo.AdjDigest(qgds.getCvencode()) + "</cvencode>\r\n";
                xmlstring = xmlstring + "<cvenname>" + Basenvo.AdjDigest(qgds.getCvenname()) + "</cvenname>\r\n";
                xmlstring = xmlstring + "<cdefine1>" + Basenvo.AdjDigest(qgds.getCdefine1()) + "</cdefine1>\r\n";
                xmlstring = xmlstring + "<cdefine2>" + Basenvo.AdjDigest(qgds.getCdefine2()) + "</cdefine2>\r\n";
                xmlstring = xmlstring + "<cdefine3>" + Basenvo.AdjDigest(qgds.getCdefine3()) + "</cdefine3>\r\n";
                xmlstring = xmlstring + "<iinvsprice>" + Basenvo.AdjDigest(qgds.getIinvsprice()) + "</iinvsprice>\r\n";
                xmlstring = xmlstring + "<cdefine4>" + Basenvo.AdjDigest(qgds.getCdefine4()) + "</cdefine4>\r\n";
                xmlstring = xmlstring + "<bapprove>" + Basenvo.AdjDigest(qgds.getBapprove()) + "</bapprove>\r\n";
                xmlstring = xmlstring + "<qgdsid>" + Basenvo.AdjDigest(qgds.getQgdsid()) + "</qgdsid>\r\n";
                xmlstring = xmlstring + "<inorder>" + Basenvo.AdjDigest(qgds.getInorder()) + "</inorder>\r\n";
                xmlstring = xmlstring + "<bclose>" + Basenvo.AdjDigest(qgds.getBclose()) + "</bclose>\r\n";
                xmlstring = xmlstring + "<djtype>" + Basenvo.AdjDigest(qgds.getDjtype()) + "</djtype>\r\n";
                xmlstring = xmlstring + "<djcvencode>" + Basenvo.AdjDigest(qgds.getDjcvencode()) + "</djcvencode>\r\n";
                xmlstring = xmlstring + "<djprice>" + Basenvo.AdjDigest(qgds.getDjprice()) + "</djprice>\r\n";
                xmlstring = xmlstring + "<canupdjxy>" + Basenvo.AdjDigest(qgds.getCanupdjxy()) + "</canupdjxy>\r\n";
                xmlstring = xmlstring + "<succount>" + Basenvo.AdjDigest(qgds.getSuccount()) + "</succount>\r\n";
                xmlstring = xmlstring + "</UffjqgdList_detail>\r\n";
            }
            xmlstring = xmlstring + "</" + param_o + ">\r\n";
        }
        xmlstring = xmlstring + "</" + methodName + ">\r\n";
        xmlstring = xmlstring + "</soap:Body></soap:Envelope>";
        return xmlstring;
    }
}
